package com.leador.db;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by liuha on 2016/9/15.
 */
public class BaseHelper extends SQLiteOpenHelper {
    public BaseHelper(Context paramContext)
    {
        super(paramContext, "LBSTRACE.db", null, 1);
    }

//    @Override
//    public void onCreate(SQLiteDatabase sqLiteDatabase) {
//
//    }
//
    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }

    public  void onCreate(SQLiteDatabase sqLiteDatabase) {
        String str = "CREATE TABLE  if not exists  trace_locationinfo (location_data TEXT);";
        try {
            sqLiteDatabase.execSQL(str);
        } catch (Exception exception) {
        }
    }


    protected  void a(SQLiteDatabase sqLiteDatabase, String paramString) {
        try {
            sqLiteDatabase.execSQL(paramString);
        } catch (Exception localException) {

        }
    }

    protected  void deleteSql(SQLiteDatabase paramSQLiteDatabase, String paramString, String[] paramArrayOfString) {
        try {
            paramSQLiteDatabase.execSQL(paramString, paramArrayOfString);
            return;
        }
        catch (Exception localException) {}
    }

    protected static Cursor b(SQLiteDatabase sqLiteDatabase, String paramString, String[] paramArrayOfString) {
        Cursor v0_1;
        try {
            v0_1 = sqLiteDatabase.rawQuery(paramString, paramArrayOfString);
        }
        catch(Exception v0) {
            v0_1 = null;
        }
        return v0_1;
    }

    protected  long selectSql(SQLiteDatabase paramSQLiteDatabase, String paramString) {
        long l = 0L;
        Cursor localCursor = null;
        try {
            (localCursor = paramSQLiteDatabase.rawQuery(paramString, null)).moveToFirst();
            l = localCursor.getLong(0);
            localCursor.close();
        }
        catch (Exception localException) {

        }
        return l;
    }
}
